<?php
include("config.php");
$url=$_SERVER["REQUEST_URI"];
//if($_GET[login]==366){
	$fromurl=$_GET['url'];
	if($_SESSION['login_mail']!=""&&$_GET['url']==""){
		echo "<script type=\"text/javascript\">location.href='index.php'</script>";
	}else if($_SESSION['login_mail']!=""&&$_GET['url']!=""){
		echo "<script type=\"text/javascript\">location.href='page.php?id=$fromurl'</script>";
		}
//	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" /><!--如果是IE8时强制以IE7显示-->
<meta name="keywords" content=""><!--SEO关键字-->
<meta name="description" content=""><!--SEO描述-->
<link rel ="" href=""><!--选项卡图标-->
<title></title>
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</head>

<body class="pr">
	<div class="lo_top">
		<div class="dib qh">
			<!-- <a href="" class="qh_bo dib">登&nbsp&nbsp录</a> -->
			<a href="register.php?pageid=<?php echo $_GET['pageid'];?>" class="qh_bo dib" >注&nbsp&nbsp册</a>
			<a href="index.php" class="qh_bo dib">浏&nbsp&nbsp览</a>
		</div>
		<div class="login_logo"><a class="login_lo dib"><img class="fl" width="210px" height="90px" alt="logo" src="img/logo1.png"></a></div><!-- LOGO -->
	</div>

	<div class="pa_login">
		<form name="myform" method="POST">
		<div class="lo_in pr"><span class="input_ico dib fl"></span><input class="mail_pw fl dib js_focusSelector" type="text" name="user_name" id="user_name"/><label class="js_inputTips pa" for="user_name">邮箱</label></div>
		<div class="lo_in pr"><span class="input_ico dib fl fouse" style=""></span><input class="mail_pw fl dib js_focusSelector" type="password" type="password" name="user_pwd" id="user_pwd"/><label class="js_inputTips pa" for="user_pwd">密码</label></div>	
		<div class="login_button">
			<a href="<?php echo $url;?>" onclick="return check_login();" class="lo_re_bo dib">登&nbsp&nbsp&nbsp&nbsp&nbsp录</a>
		</div>
		<div id="suggest" style="color:red"></div>
		</form>
		<div class="login_help">
			<a href="" class="f12 for">忘记密码？</a>	
			<span class="f12 for">|&nbsp&nbsp </span>
			<span class="f12 for choose_login">其他方式登录</span>
		</div>	
	</div> 
	
	 
	<div class="login_another none w pa tc">
		<a class="login_renren" href="">人人网</a>
		<a class="login_qq" href="http://www.kuaipaila.com/qqsdk/oauth/qq_login.php">QQ</a>
		<a class="login_douban" href="#">豆瓣</a>
		<a class="login_weibo" href="https://api.weibo.com/oauth2/authorize?client_id=1573692200&redirect_uri=http%3A%2F%2Fwww.kuaipaila.com%2Fwbsdk%2Fcallback.php&response_type=code">新浪微博</a>
		<a class="login_qqweibo" href="#">腾讯微博</a>
		<a class="login_msn" href="#">MSN</a>
	</div>

</body>

	
<script type="text/javascript">
	function check_login(){
		if($("#user_name").val()==''){G("suggest").innerHTML="请输入用户名";return false;}
		if($("#user_pwd").val()==''){G("suggest").innerHTML="请输入密码";return false;}
		var login = logins();
		if(login.length > 100){return true;}
		else if(login=='false'){G("suggest").innerHTML="用户名或密码错误";return false;}
		else if(login=='no user'){G("suggest").innerHTML="用户名不存在";return false;}
		return false;
		}			
	function G(id) {
    return document.getElementById(id);
		}
		
	function logins(){
		var temp
		$.ajax({url:"ajax/user_login.php?request=1366&user_name="+$("#user_name").val()+"&user_pwd="+$("#user_pwd").val()+"",async:false,success:function(result){
			//alert(result);
			temp=result;
		}});
		return temp;
	}
		</script>